<template>
  <div class="breadcrumb d-flex vertical">
    <svg-icon icon-class="icon-rili" @click.native="collapse"></svg-icon>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item v-for="(item, index) in list" :key="index">{{
        item.meta.title
      }}</el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>
<script>
import { mapMutations } from 'vuex'
export default {
  data() {
    return {
      list: []
    }
  },
  watch: {
    $route() {
      this.getBreadcrumb()
    }
  },
  created() {
    this.getBreadcrumb()
  },
  methods: {
    getBreadcrumb() {
      this.list = this.$route.matched.filter(item => !item.meta.hidden)
    },
    ...mapMutations(['collapse'])
  }
}
</script>
<style lang="scss" scoped>
.svg-icon {
  margin-right: 10px;
  cursor: pointer;
}
</style>
